import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

import Icons from 'unplugin-icons/vite'             // 导入icon相关插件
import IconsResolver from 'unplugin-icons/resolver' // 导入icon相关插件
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),
  AutoImport({
      resolvers: [
        ElementPlusResolver(),
        IconsResolver({
          prefix: 'Icon',
        }),
      ],
    }),
    Components({
      resolvers: [
        ElementPlusResolver(),
        IconsResolver({
          enabledCollections: ['ep']
        }),
      ]
    }),
    Icons({
      autoInstall: true,
    }),
  ],
    resolve: {
    alias: {
      "@": resolve(__dirname, './src'), 
    },
    extensions: ['.js', '.json', '.ts'] 
  },
  server:{
    host:'localhost',
    port:8008,
    open:true,
    hot:true
  }
})